package com.xiaoyu.lanling.feature.user.options

import android.content.Context
import androidx.appcompat.app.AlertDialog
import com.xiaoyu.base.app.AppContext
import com.xiaoyu.base.model.User
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.router.Router

class ReportAction(context: Context, private val user: User, private val fromType: String) : MoreActionItemBase(context) {

    override val title: CharSequence
        get() = mContext.getString(R.string.user_more_action_report)

    override fun onClick() {
        val items = reasonMap.keys.toTypedArray()
        AlertDialog.Builder(mContext)
                .setItems(items) { _, which ->
                    Router.instance.gotoReportActivity(mContext, "user", user.uid, reasonMap[items[which]])
                }
                .show()
    }

    companion object {
        val reasonMap = mutableMapOf<String, String>().apply {
            put(AppContext.getString(R.string.report_reason_deraud), "defraud")
            put(AppContext.getString(R.string.report_reason_harass), "harass")
            put(AppContext.getString(R.string.report_reason_abuse), "abuse")
            put(AppContext.getString(R.string.report_reason_gender_mismatch), "gender_mismatch")
            put(AppContext.getString(R.string.report_reason_advertising), "advertising")
            put(AppContext.getString(R.string.report_reason_others), "others")
        }
    }
}